﻿using System;
using KouakKore;
using System.Net;
using System.Reflection;

namespace Kouak
{
    class Program
    {
        public static void Main(string[] Args)
        {
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
            {
                String ressourceName = "Kouak.DLL." + new AssemblyName(args.Name).Name + ".dll";
                using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(ressourceName))
                {
                    Byte[] assemblyData = new Byte[stream.Length];
                    stream.Read(assemblyData, 0, assemblyData.Length);
                    return Assembly.Load(assemblyData);
                }
            };
            Program p = new Program();
            p.start(Args);
         }

        private void start(string[] Args)
        {
            Console.WriteLine("Public IP : {0} \nLocal IP : {1}", KouakIP.GetExternalIp(), KouakIP.GetLocalIpAdress());
            KouakLauncher k = new KouakLauncher();
            k.Launch(Args);

            while (true)
            {
                Console.ReadKey();
            }
        }
    }
}
